<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>学习3d</title>
  <style>
    p {
      width: 50px;
      height: 50px;
      animation: 3s linear slidein infinite alternate;
      transform-origin: left bottom;
    }
    @keyframes slidein {
      from{ transform: perspective(500px) translate3d(10px, 0px, 0px);
        background-color: red;
      }
      to{ transform: perspective(500px) translate3d(200px, 0px, 100px);
        background:linear-gradient(.25turn, red, 10%, blue);
      }
    }
  </style>
</head>
<body>
  <p></p>
  <hr>
</body>
</html>